#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

int main() {
	char buf[1024];
	char inj[1024];
	char ch;

	gets(buf);
	gets(inj);

	scanf("%c",&ch);

	char* t = buf;

	while (*t != 0 && *t != ch) {
		putchar(*t);
		t++;
	}

	printf("%s", inj);

	while (*t != 0) {
		putchar(*t);
		t++;
	}

	puts("");
}